package com.qys.livesMall.anchor.model.dto.lives.sys;

import com.qys.livesMall.common.exception.QysException;
import com.qys.livesMall.common.utils.MessageUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

@Data
public class LiveRoomBanDateDTO {

    @Schema(description = "直播间id")
    @NotNull(message = "{直播间id为空}")
    private Long livesRoomId;

    @Schema(description = "修改天数")
    private Integer day;

    @Schema(description = "增减 1:增加  2：减少")
    private Byte plusOrMinus;

    @Schema(description = "是否永封")
    private Boolean foreverFlag = false;


    public Integer getChangeDay() {
        if (this.day == null || this.day <= 0) {
            throw new QysException(MessageUtils.message("请输入增减天数,且必须大于0"));
        }
        if (this.plusOrMinus == null) {
            throw new QysException(MessageUtils.message("请选择增减类型"));
        }
        return this.plusOrMinus == 1 ? this.day : -this.day;
    }


}
